<?php
function catat_log($kd, $aksi) {
	mysql_query("INSERT INTO t_loginout VALUES($kd,'$aksi',NOW())");
}

function info_pegawai($kd) {
	$dt = mysql_fetch_array(mysql_query("
		SELECT *
		FROM t_pegawai a
		LEFT JOIN r_jabatan b ON a.kd_jabatan=b.kd_jabatan
		inner join t_pengguna c on a.kd_pengguna=c.kd_pengguna
		WHERE a.kd_pengguna='$kd'
		ORDER BY a.kd_pegawai
	")); 

	/*$dt = mysql_fetch_array(mysql_query("	
		SELECT a.kd_pegawai,a.nm_lengkap, b.kd_jabatan, b.nm_jabatan, c.username
		FROM t_pegawai a
		LEFT JOIN r_jabatan b ON a.kd_jabatan=b.kd_jabatan
    inner join t_pengguna c on a.kd_pengguna=c.kd_pengguna
	"));*/
	
	$info[] = $dt['kd_pegawai'];
	$info[] = $dt['nm_lengkap'];
	$info[] = $dt['kd_jabatan'];
	$info[] = $dt['nm_jabatan'];
	$info[] = $dt['username'];	
	
	return $info;
}


function ambil_nama($id, $tabel) {
	$dt = mysql_fetch_array(mysql_query("SELECT nm_lengkap FROM t_".$tabel." WHERE kd_pengguna=".$id));
	return $dt[0];
}

function ambil_jabatan($id) {
	$dt = mysql_fetch_array(mysql_query("SELECT nm_grup FROM t_grup WHERE kd_grup=".$id));
	return $dt[0];
}
?>
